import aioredis

# 配置 Redis 连接
import asyncio

REDIS_HOST = '192.168.8.199'
REDIS_PORT = 6379
REDIS_PASSWORD = '1qaz2wsx'  # 替换为你的 Redis 密码
redis = None

import redis


def get_data():
    redis_client = redis.StrictRedis(
        host=REDIS_HOST,
        port=REDIS_PORT,
        password=REDIS_PASSWORD,
        decode_responses=True
    )

    item = redis_client.get("login_tokens:885f6cfb-9760-42ff-a5d6-97aba7357a1d")
    print(item)


async def get_redis():
    redis = await  aioredis.from_url(
        f'redis://{REDIS_HOST}:{REDIS_PORT}',
        password=REDIS_PASSWORD,
        minsize=10,
        maxsize=20
    )
    item = await   redis.get("456610b2-11d3-4573-b0fc-064672a92b72")
    print(item)

if __name__ == "__main__":
    get_data()
